<template>
	<view>
		<view class="">
			<view>
				头像
			</view>
			<view>
				<u-avatar :src="`http:${userInfo.head}`" @click="uploadAvatar"></u-avatar>
			</view>
		</view>
		<view class="">
			<view class="">
				<view>
					昵称
				</view>
				<view>
					<u--input v-model="userInfo.nickname"></u--input>
				</view>
			</view>
			<view class="">
				<view>
					性别
				</view>
				<view>
					<u--input v-model="userInfo.gender"></u--input>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {createNamespacedHelpers} from 'vuex'
	const {mapState,mapActions}=createNamespacedHelpers('users')
	export default {
		data() {
			return {
				
			}
		},
		computed:{
			...mapState(['authToken','userInfo'])
		},
		methods: {
			uploadAvatar(){
				uni.chooseImage({
					count: 1,
					sizeType: ['compressed'],
					sourceType: ['album', 'camera'],
					success(res) {
						console.log('res',res);
						uni.uploadFile({
							url:'http://vueshop.glbuys.com/api/user/myinfo/formdatahead?token=1ec949a15fb709370f',
							formData:{
								headfile:res.tempFiles[0]
							},
							success(response) {
								console.log('----',JSON.parse(response.data));
							}
						})
					}
				})
			}
		}
	}
</script>

<style>

</style>
